{include file="public/header" /}
<style>
    .layui-form-item{
        margin: 0;
    }
    .layui-form-label{
        width: 200px;
    }
    .layui-input-block{
        margin-left: 200px;
    }

</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox-content layui-form">
        <div class="layui-row layui-col-space10 layui-form-item ">
            <input type="hidden" name="p_id" value="{$data.p_id}">
            <input type="hidden" name="type" value="{$type}">
            {if $type == 1}
            <div class="layui-form-item layui-col-md-offset1 layui-col-xs8 form-group">
                <label class="layui-form-label">审核：</label>
                <div class="layui-input-block">
                    <select name="checkDo"  lay-filter="role1">
                        <option value="3" selected>同意</option>
                        <option value="4">拒绝</option>
                    </select>
                </div>
            </div>
            {/if}
            <div class="single">
            <div style="width: 100%;clear: both;background-color: #f5f5f5;padding: 10px;font-weight: bold;font-size: 16px;">非团团赚商品分佣配置（商品现价：{$data.p_now_price}）：</div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">总分佣金额 ¥：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_single_all_money" value="{$data.p_m_single_all_money}" step="0.01" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">一级分佣金额 ¥：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_single_one_money" value="{$data.p_m_single_one_money}" step="0.01" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">一级分佣积分：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_single_one_jifen" value="{$data.p_m_single_one_jifen}" step="1" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">二级分佣金额 ¥：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_single_two" value="{$data.p_m_single_two}" step="0.01" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">系统服务费金额 ¥：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_single_system" value="{$data.p_m_single_system}" step="0.01" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-md-offset1 layui-col-xs8 form-group">
                <label class="layui-form-label">团团赚是否开启：</label>
                <div class="layui-input-block">
                    <select name="p_m_team_status" class="p_m_team_status"  lay-filter="role2">
                        <option value="1" {if $data.p_m_team_status == 1}selected{/if}>开启</option>
                        <option value="2" {if $data.p_m_team_status == 2}selected{/if}>关闭</option>
                    </select>
                </div>
            </div>
            </div>
            <div class="team">
            <div style="width: 100%;clear: both;background-color: #f5f5f5;padding: 10px;font-weight: bold;font-size: 16px;">团团赚商品分佣配置（商品现价：{$data.p_now_price}）：</div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">总分佣金额 ¥：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_team_all_money" value="{$data.p_m_team_all_money}" step="0.01" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">团长分佣金额 ¥：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_team_leader_money" value="{$data.p_m_team_leader_money}" step="0.01" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">团长分佣积分：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_team_leader_jifen" value="{$data.p_m_team_leader_jifen}" step="1" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">凡参与都可获得金额 ¥：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_team_join_money" value="{$data.p_m_team_join_money}" step="0.01" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">凡参与都可获得积分：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_team_join_jifen" value="{$data.p_m_team_join_jifen}" step="1" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">系统服务费金额 ¥：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_team_system" value="{$data.p_m_team_system}" step="0.01" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">参团人数：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_team_nums" value="{$data.p_m_team_nums}" step="1" lay-verify="number" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <label class="layui-form-label">有效时间（单位是小时）：</label>
                <div class="layui-input-block">
                    <input type="number" name="p_m_team_hours" value="{$data.p_m_team_hours}" step="1" lay-verify="number" class="layui-input" />
                </div>
            </div>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                    </button>
                    <button class="layui-btn layui-btn-primary" onclick="wk.layer_close('close')">关闭</button>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/footer" /}
<script>
    layui.use(['form'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('button').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('checkPoll')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        layer.msg(res.msg,{icon:1,time:1500,shade:0.1},function(index){
                            wk.layer_close();
                        })
                    } else {
                        $("button").removeClass('layui-disabled').removeAttr('disabled');
                        wk.error(res.msg);
                        return false;
                    }
                }
            })
        });
        form.on('select(role1)', function(data){
            var teamStatus = $('.p_m_team_status').val();
            if(data.value == 3){
                $('.single').removeClass('hidden');
                if(teamStatus == 1){
                    $('.team').removeClass('hidden');
                    $('.layui-input').attr('lay-verify','number');
                }
            }else{
                $('.layui-input').removeAttr('lay-verify');
                $('.single').addClass('hidden');
                $('.team').addClass('hidden');
            }
            $('.layui-form-select input').removeAttr('lay-verify');
        });
        form.on('select(role2)', function(data){
            if(data.value == 1){
                $('.team').removeClass('hidden');
                $('.team input').attr('lay-verify','number');
            }else{
                $('.team input').removeAttr('lay-verify');
                $('.team').addClass('hidden');
            }
        });
    });
</script>
</body>
</html>